﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace HCMS.Utils
{
    /// <summary>
    /// MD5 加密工具类
    /// </summary>
    public class MD5EncryptUtil
    {
        #region MD5Encrypt MD5 加密 
        /// <summary>
        /// MD5 加密
        /// </summary>
        /// <param name="str">待加密字符串</param>
        /// <returns>加密后的 32位大写 字符串</returns>
        public static string MD5Encrypt(string str)
        {
            using (var md5 = MD5.Create())
            {
                var result = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
                var strResult = BitConverter.ToString(result);
                return strResult.Replace("-", "");
            }
        }
        #endregion
    }
}
